Skip to content

Files: Add experimental Files block for listing multiple files - #82852

Draft
im3dabasia wants to merge 12 commits into
add/file-block-flex-layoutfrom
add/file-block-multiple-files
Draft

im3dabasia wants to merge 12 commits into
add/file-block-flex-layoutfrom
add/file-block-multiple-files

Conversation

@im3dabasia

Copy link
Copy Markdown
Contributor

What?

Closes #19951
Depends on #82851

Adds an experimental Files block that lists several downloadable files, one File block per row.

Why?

  • Adding several files currently means stacking separate File blocks.
  • Stacked File blocks aren't announced as a list by screen readers.

How?

  • New core/files block holding File blocks, like Gallery holds Images.
  • Gated behind the "Block experiments" experiment.
  • File block placeholder accepts several files and groups them in a Files block.
  • Dropping several non-media files creates a Files block.
  • One toolbar control justifies every row; "Add files" appends more.
  • Rendered as a list with list items on the front end.
  • Existing File blocks are unchanged; no deprecation.

Testing Instructions

  1. Enable "Block experiments" in Gutenberg > Experiments.
  2. Add a File block and select several files from the Media Library.
  3. Check they become a Files block with one row per file.
  4. Use "Add files" in the toolbar to append more.
  5. Set "Space between" and check every row's button moves right.
  6. Drop several PDFs into the editor and check they become a Files block.
  7. Select several File blocks, transform them to Files, then ungroup.
  8. On the front end, check the block is a list with list items.

Testing Instructions for Keyboard

  1. Insert a Files block with the inserter and open the Media Library with Enter.
  2. Select several files with Space and confirm with Enter.
  3. Reach "Add files" and the justification control via Alt+F10.

Screenshots or screencast

Use of AI Tools

Claude Code

@github-actions github-actions Bot added the [Package] Block library /packages/block-library label Sep 14, 2026
@im3dabasia
im3dabasia changed the base branch from trunk to add/file-block-flex-layout September 14, 2026 14:44
@im3dabasia
im3dabasia added this pull request to stack #82853 September 14, 2026 14:45
@im3dabasia im3dabasia self-assigned this Sep 14, 2026
@im3dabasia im3dabasia added [Block] File Affects the File Block [Type] Enhancement A suggestion for improvement. labels Sep 14, 2026
@github-actions

github-actions Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

📦 Bundle size

Size Change: +1.53 kB (+0.02%)

Total Size: 8.21 MB

📦 View Changed
Filename Size Change
build/scripts/block-library/index.min.js 365 kB +1.12 kB (+0.31%)
build/styles/block-library/files/style-rtl.css 94 B +94 B (new file) 🆕
build/styles/block-library/files/style-rtl.min.css 81 B +81 B (new file) 🆕
build/styles/block-library/files/style.css 94 B +94 B (new file) 🆕
build/styles/block-library/files/style.min.css 81 B +81 B (new file) 🆕
build/styles/block-library/style-rtl.css 22.3 kB +15 B (+0.07%)
build/styles/block-library/style-rtl.min.css 18.9 kB +14 B (+0.07%)
build/styles/block-library/style.css 22.4 kB +15 B (+0.07%)
build/styles/block-library/style.min.css 18.8 kB +14 B (+0.07%)

df6e9a3 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric 68e3295 trunk % Change
timeToFirstByte 48.95 ms +2.04% -4.39% 48.1 ms +8% -3.33% 1.77%
largestContentfulPaint 80 ms +5% -0% 80 ms +2.5% -0% 0%
lcpMinusTtfb 32.35 ms +6.03% -4.02% 31.15 ms +6.1% -3.53% 3.85%
wpBeforeTemplate 22.9 ms +4.54% -2.75% 22.74 ms +11.17% -1.98% 0.7%
wpTemplate 21.65 ms +5.59% -3.19% 21.4 ms +2.34% -2.71% 1.17%
wpTotal 45.24 ms +2.41% -4.11% 44.63 ms +6.99% -3.7% 1.37%
wpMemoryUsage 7.54 MB +0% -0% 7.49 MB +0% -0% 0.67%
wpDbQueries 17 +0% -0% 17 +0% -0% 0%

front-end-classic-theme

Metric 68e3295 trunk % Change
timeToFirstByte 40.05 ms +5.74% -2.5% 39.4 ms +4.57% -0.89% 1.65%
largestContentfulPaint 92 ms +0% -2.17% 92 ms +0% -2.17% 0%
lcpMinusTtfb 51.05 ms +3.53% -3.43% 51.45 ms +2.53% -2.72% -0.78%
wpBeforeTemplate 20.7 ms +4.54% -1.26% 20.61 ms +5.63% -2.13% 0.44%
wpTemplate 16.49 ms +2.49% -4.24% 16.13 ms +2.11% -2.67% 2.23%
wpTotal 37.22 ms +5.7% -2.79% 36.7 ms +3.9% -1.14% 1.42%
wpMemoryUsage 6.16 MB +0% -0% 6.11 MB +0% -0% 0.84%
wpDbQueries 14 +0% -0% 14 +0% -0% 0%

media-processing

Metric 68e3295 trunk % Change
mediaProcessingJpeg 406.63 ms +0.24% -1.51% 405.89 ms +1% -1.09% 0.18%
mediaProcessingAvif 6239.9 ms +0.23% -0.1% 6245.17 ms +0.1% -0.24% -0.08%
mediaProcessingJpegToAvif 4283.37 ms +0.19% -0.18% 4285.62 ms +0.16% -0.14% -0.05%

media-upload

Metric 68e3295 trunk % Change
jpegUploadProcessing 1448.84 ms +35.15% -2.08% 1431.16 ms +0.71% -1.01% 1.24%
pngUploadProcessing 197.58 ms +5.72% -3.07% 202.72 ms +6.36% -4.42% -2.54%
largeJpegUploadProcessing 1428.73 ms +0.76% -0.63% 1418.85 ms +0.47% -0.19% 0.7%
multipleImageUploadProcessing 2068.85 ms +1.34% -21.22% 1640.33 ms +25.58% -4.56% 26.12%

post-editor

Metric 68e3295 trunk % Change
serverResponse 320.34 ms +2.65% -8.44% 292.3 ms +2.5% -6.16% 9.59%
firstPaint 165.27 ms +6.94% -6.95% 147.21 ms +46.78% -7.41% 12.27%
domContentLoaded 764.46 ms +3.96% -3.05% 731.2 ms +0.65% -1.81% 4.55%
loaded 765.52 ms +3.97% -3.06% 732.13 ms +0.64% -1.82% 4.56%
firstContentfulPaint 333.58 ms +5.56% -6.08% 310.1 ms +1.97% -2.32% 7.57%
firstBlock 2271.36 ms +3.76% -4.01% 2126.04 ms +2.05% -0.5% 6.84%
type 17.21 ms +13.71% -6.04% 16.91 ms +1.24% -6.27% 1.77%
typeWithoutInspector 16.43 ms +2.19% -2.43% 17.51 ms +11.59% -6.45% -6.17%
typeWithTopToolbar 21.39 ms +3.69% -2.71% 22.07 ms +6.39% -1.86% -3.08%
typeContainer 7.81 ms +2.3% -5.25% 7.89 ms +3.8% -5.83% -1.01%
focus 53.44 ms +13.32% -0.84% 58.64 ms +4.54% -6.92% -8.87%
firstFocus 147.31 ms +0% -0% 169.12 ms +0% -0% -12.9%
selectAll 330.25 ms +4.64% -5.39% 352.14 ms +1.45% -5.76% -6.22%
listViewOpen 52.01 ms +4.21% -6.79% 51.14 ms +6.53% -5.46% 1.7%
inserterOpen 18.42 ms +13.14% -4.13% 20.63 ms +15.9% -8.58% -10.71%
inserterHover 2.71 ms +19.56% -21.4% 2.94 ms +8.16% -10.2% -7.82%
inserterSearch 7.12 ms +9.55% -1.83% 7.99 ms +4.76% -5.63% -10.89%
loadPatterns 468.78 ms +5.59% -2.11% 483.01 ms +3.58% -4.14% -2.95%
wpTotal 312.34 ms +2.78% -8.86% 284.61 ms +2.61% -6.37% 9.74%
wpMemoryUsage 13.08 MB +0% -0% 13.03 MB +0% -0% 0.39%
wpDbQueries 54 +0% -0% 54 +0% -0% 0%

site-editor

Metric 68e3295 trunk % Change
serverResponse 505.37 ms +1.17% -1.02% 505.72 ms +1.6% -3.93% -0.07%
firstPaint 311.51 ms +50.26% -14.34% 284.6 ms +13.49% -19.28% 9.46%
domContentLoaded 1139.42 ms +1.73% -0.67% 1142.85 ms +1.83% -1.81% -0.3%
loaded 1140.79 ms +1.72% -0.67% 1144.15 ms +1.81% -1.81% -0.29%
firstContentfulPaint 464.77 ms +1.25% -5.62% 456.57 ms +2.96% -2.76% 1.8%
firstBlock 4265.35 ms +0.38% -1% 4218.17 ms +0.62% -1.35% 1.12%
type 21.02 ms +1.14% -4.61% 19.8 ms +8.99% -0.91% 6.16%
navigate 116.54 ms +11.92% -3.11% 113.57 ms +6.88% -9.15% 2.62%
loadPatterns 1567.69 ms +11.68% -10.42% 1308.47 ms +11.7% -4.94% 19.81%
loadPages 1071.03 ms +0.49% -0.65% 1073.66 ms +2.64% -0.9% -0.24%
wpTotal 495.95 ms +1.06% -1.17% 495.87 ms +1.63% -3.9% 0.02%
wpMemoryUsage 12.02 MB +0% -0% 11.97 MB +0% -0% 0.43%
wpDbQueries 43 +2.33% -0% 43 +2.33% -0% 0%

df6e9a3 Run

@im3dabasia
im3dabasia force-pushed the add/file-block-multiple-files branch from 66e708d to 1e70cf7 Compare September 15, 2026 05:49
@im3dabasia
im3dabasia force-pushed the add/file-block-multiple-files branch from 1e70cf7 to b86503c Compare September 15, 2026 06:16

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] File Affects the File Block [Package] Block library /packages/block-library [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

core/file: select multiple attachments

1 participant